<template>
	<view>
		<!-- #ifdef APP-PLUS -->
		<Header :isShowRight="false" title="开票历史" @back='back' arrowColor='#000' textColor='#000'></Header>
		<!-- #endif -->
		<z-paging ref="paging" v-model="dataList" @query="queryList" class="box" v-if="isshow">
			<!-- #ifdef APP-PLUS -->
			<view style="height: 120rpx;"></view>
			<!-- #endif -->
			<view  style="margin-top:28rpx">
				<view class="item" v-for='(item,index) in list' :key='index' @click='orderDetail(item)'>
					<view class="firstBox">
						<view class="iconBox">
							<u-icon name="clock" color="#9B9B9B" size="30"></u-icon>
							<view class="">{{item.createTime}}</view>
						</view>
						<view class="status1" v-if='item.invoiceStatus==1'>开票中</view>
						<view class="status2" v-if='item.invoiceStatus==2'>已开票</view>
					</view>
					<view class="secondBox">
						<view class="box1">
							<view class="" v-if='item.invoiceType==1'>电子发票</view>
							<view class="" v-else>纸质发票</view>
							<view class="invoiceMoney">
								<text>￥</text>
								<view class="">{{item.invoiceMoney}}</view>
							</view>
						</view>
						<view class="">
							<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/rightDown1.png" style="width:33rpx;height: 33rpx;"></image>
						</view>
					</view>
		
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
	import {
		invoiceHistory
	} from '@/apis/apis.js'
	import Header from '@/components/c_header.vue'
	export default {
		data() {
			return {
				dataList: [],
				list: [],
				isshow:false
			}
		},
		components: {
			Header
		},
		onShow() {
			// this.$nextTick(()=>{
			// 	this.$refs.pagings.reload();
			// })
			this.isshow = true
		},
		onHide() {
			this.isshow = false
		},
		methods: {
			queryList(pageNo, pageSize) {
				invoiceHistory({
					pageNum: pageNo,
					pageSize: pageSize
				}).then(res => {
					console.log(res)
					res.data.forEach(item => {
						item.invoiceMoney = item.invoiceMoney.toFixed(2)
					})
					this.list = res.data
					this.$refs.paging.complete(res.data);

				})

			},
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			orderDetail(item){
				console.log(item);
				uni.navigateTo({
					url:'../make?id='+item.id
				})
			}
		}
	}
</script>

<style scoped lang='scss'>
	.box {
		/* background: #F8F8F8; */
		width: 100%;
		min-height: 100vh;
	}

	.bg {
		width: 100%;
		position: fixed;
		z-index: 999;
		top: 0;
		/* height: 140rpx; */
		padding: 76rpx 30rpx 20rpx 30rpx;
		/* padding: 78rpx 0 0 32rpx; */
		background: #fff;
	}

	.item {
		width: 95%;
		box-sizing: border-box;
		padding: 42rpx 29rpx;
		margin: 0 auto;
		margin-bottom: 28rpx;
		background: #fff;
		box-shadow: 0rpx 7rpx 27rpx 0rpx rgba(127,129,133,0.15);
		border-radius: 20rpx;

		.firstBox {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30rpx;
			margin-bottom: 43rpx;

			.iconBox {
				display: flex;
				align-items: baseline;
				color: #9B9B9B;
				&>view{
					padding-left: 8rpx;
				}
			}

			.status1 {
				color: #F04848;
			}

			.status2 {
				color: #3BB66C
			}
		}

		.secondBox {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30rpx;
			color: #020202;

			.box1 {
				display: flex;
				align-items: baseline;

				.invoiceMoney {
					padding-left: 24rpx;
					display: flex;
					align-items: baseline;
					color: #FFA025;
					font-size: 36rpx;
					&>text {
						font-size: 22rpx;
					}
				}
			}
		}
	} 
</style>
